﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.Data;
using System.Reflection;
using System.Runtime.Serialization;
using System.Data.Objects;

namespace GTServices.Entities
{
    
    public class FileExtension : BaseEntity
    {
        [Key] 
        public String Extension { get; set; }

        [IgnoreDataMember]
        public virtual ObservableCollection<Language> Languages { get; set; } 

        public FileExtension()
        {
            this.Extension = "";
            Languages = new ObservableCollection<Language>(); 
        }

        public override void Validate()
        {
            if (String.IsNullOrEmpty(Extension))
            {
                throw new ArgumentException("Null or Empty Extension");
            }
        }

        public override bool Equals(object obj)
        {
            if (!(obj is FileExtension))
            {
                return false;
            }
            return (obj as FileExtension).Extension == this.Extension;
        }

    }
}
